//
//  NSTimer+JZBlocksSupport.m
//  tf02
//
//  Created by Jim on 2017/3/10.
//  Copyright © 2017年 Jim. All rights reserved.
//

#import "NSTimer+JZBlocksSupport.h"

@implementation NSTimer (JZBlocksSupport)

+ (NSTimer *)jzBlocksSupport_scheduledTimerWithTimeInterval:(NSTimeInterval)interval block:(void (^)(void))block repeats:(BOOL)repeats
{
    return [self scheduledTimerWithTimeInterval:interval
                                         target:self
                                       selector:@selector(private_blockInvoke:)
                                       userInfo:[block copy]
                                        repeats:repeats];
}

+ (void)private_blockInvoke:(NSTimer *)timer
{
    void (^block)(void) = timer.userInfo;
    
    if (block) {
        block();
    }
}

@end















